package com.ruoyi.integration.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "第三方气象站数据调用返回响应封装实体类",description = "")
public class DustResponse {

    @ApiModelProperty(value = "返回状态码")
    private int code;
    @ApiModelProperty(value = "返回消息")
    private String message;
    @ApiModelProperty(value = "返回数据")
    private List<DeviceData> data;

    @Data
    @ApiModel(value = "第三方气象站数据调用返回响应数据实体类",description = "")
    public static class DeviceData {

        @ApiModelProperty(value = "系统码: 表示物联网设备类型; 示例: iot")
        private String systemCode;
        @ApiModelProperty(value = "设备地址: 唯一标识一个物联网设备; 示例: 20030608(int)")
        private long deviceAddr;
        @ApiModelProperty(value = "设备名称: 描述物联网设备名称; 示例: 20030608(str)")
        private String deviceName;
        @ApiModelProperty(value = "经度: 描述物联网设备经度; 示例: 39.72152490309037")
        private double lat;
        @ApiModelProperty(value = "纬度: 描述物联网设备纬度; 示例: 111.26939633761702")
        private double lng;
        @ApiModelProperty(value = "设备状态; normal:正常,alarming:报警,preAlarming:预警,offline:离线")
        private String deviceStatus;

        @ApiModelProperty(value = "中继状态(字符串表示的relayStatusItems)")
        private String relayStatus;

        @ApiModelProperty(value = "中继状态(无需理会的返回响应)")
        private List<RelayStatusItem> relayStatusItems;

        @ApiModelProperty(value = "数据项列表(系统需要持久化存储的返回响应)")
        private List<DataItem> dataItem;

        @ApiModelProperty(value = "数据时间戳; 示例: 1761651709042")
        private long timeStamp;
    }

    @Data
    public static class RelayStatusItem {

        @ApiModelProperty(value = "中继编号; 示例: 0/1")
        private int relayNo;
        @ApiModelProperty(value = "中继状态; ")
        private int relayStatus;
    }

    @Data
    public static class DataItem {

        @ApiModelProperty(value = "采集数据编号; 示例: 由1开始递增")
        private int nodeId;
        @ApiModelProperty(value = "数据项列表")
        private List<RegisterItem> registerItem;
    }

    @Data
    public static class RegisterItem {

        @ApiModelProperty(value = "数据项编号;")
        private int registerId;
        @ApiModelProperty(value = "数据项值(取整的数值)|风向: 数据 的中文标识")
        private String data;
        @ApiModelProperty(value = "数据项值(包括未取整的数值)|数据标识的风向")
        private double value;
        @ApiModelProperty(value = "报警等级")
        private int alarmLevel;
        @ApiModelProperty(value = "报警颜色")
        private String alarmColor;
        @ApiModelProperty(value = "报警信息; 示例: 20030608_2_风向 设备地址：20030608, 报警内容西南风,报警时间：2025-10-28 19:41:49")
        private String alarmInfo;
        @ApiModelProperty(value = "数据项单位")
        private String unit;
        @ApiModelProperty(value = "数据项名称")
        private String registerName;
    }
}
